package com.qqla.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qqla.dto.StudyQueryPage;
import com.qqla.entity.Study;
import com.qqla.mapper.StudyMapper;
import com.qqla.result.PageResult;
import com.qqla.service.StudyService;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class StudyServiceImpl extends ServiceImpl<StudyMapper, Study> implements StudyService {

    /*
     * 分页获取学习列表数据
     * */
    @Override
    public PageResult getStudyList(StudyQueryPage studyQueryPage) {

        // sql 查询
        Page<Study> page = lambdaQuery().page(new Page<>(studyQueryPage.getPage(), studyQueryPage.getPageSize()));

        PageResult result = PageResult.builder().total(page.getTotal()).records(page.getRecords()).build();

        return result;
    }

}
